package code.command {

import code.Cookie;
import code.Model;
import code.event.LogoutEvent;

import com.adobe.cairngorm.commands.ICommand;
import com.adobe.cairngorm.control.CairngormEvent;

import logging.Logger;

import mx.core.Application;

public class LogoutCommand implements ICommand {
	
	private static const LOG: Logger = Logger.getLogger("code.command.LogoutCommand");
	
	public function LogoutCommand() {
	}

	public function execute(_event: CairngormEvent):void {
		const event: LogoutEvent = _event as LogoutEvent;
		LOG.fine("Executing logout [event="+event+"].");
		
		Cookie.instance.clearDataAndFlush();
		Model.instance.currentUser = null;
		Application.application.currentState = 'stateLogin';
	}
	
}
}